<?php 
	$array_date_mysql = explode(" ", $commande->getDateCreation());
    $array_date_mysql = explode("-", $array_date_mysql[0]);
?>
<a href="<?php echo url_for('commande/index') ?>">Vos Commandes</a><label>&nbsp; &gt; &nbsp;<?php echo "COM".$array_date_mysql[0].$array_date_mysql[1].$array_date_mysql[2]."-".$commande->getId(); ?></label>
<hr />

<table id="table_commande">
  <tbody>
    <tr>
     	<th class="align_center">Statut</th>
      	<th class="align_center">Date creation</th>
     	<th class="align_center">Date paiement</th>
      	<th class="align_center">Date expedition</th>
    </tr>
    <tr>
    	<td class="align_center"><?php echo $commande->getStatut() ?></td>
    	<td class="align_center">
	      <?php
		      $array_date_mysql = explode(" ", $commande->getDateCreation());
		      echo $array_date_mysql[0];
	      ?>
	 	</td>
    	<td class="align_center">
	      <?php
		      $array_date_mysql = explode(" ", $commande->getDatePaiement());
		      echo $array_date_mysql[0];
	      ?>
	  	</td>
    	<td class="align_center">
	      <?php
		      $array_date_mysql = explode(" ", $commande->getDateExpedition());
		      echo $array_date_mysql[0];
	      ?>
	  	</td>
    </tr>
  </tbody>
</table>

<hr/>
<h2>Détails de la Commande</h2>
<table id="table_commande">
  <thead>
    <tr>
      <th>Produit</th>
      <th class="align_right">Prix</th>
      <th class="align_center">Quantite</th>
      <th class="align_right">Total</th>
    </tr>
  </thead>
  <tbody>
  		<?php
  		
  		foreach ($lignecommande_list as $ligne_commande): ?>
  		<tr>
	  		<td>
	  			<?php 
		  			$prods = new ProduitPeer();
		  			$produit = $prods->retrieveByPK($ligne_commande->getProduitId());
		  		?>
		  			<a href="<?php echo url_for('produit/show?id='.$produit->getId()) ?>"><?php echo $produit->getNom();?></a>
	  		</td>
	  		<td class='align_right'><?php echo ($ligne_commande->getValeur() / $ligne_commande->getQuantite()) ?>&nbsp;€</td>
	  		<td class='align_center'><?php echo $ligne_commande->getQuantite() ?></td>
	  		<td class='align_right'><?php echo $ligne_commande->getValeur() ?>&nbsp;€</td>
  		</tr>
  		
  		<?php endforeach; ?>
  </tbody>
</table>
<hr />
<label>Prix total : <?php echo $commande->getMontant() ?>&nbsp;€</label>

